<style>
    #examine-detail {
        padding: 20px 25px 25px 0;
    }

    .layui-form-label {
        width: 140px;
    }

    .layui-input-block {
        margin-left: 170px;
    }

    #examine-detail span {
        margin: 0 0 2px 3px !important;
    }

    .layui-layer-page .layui-layer-content {
        overflow: visible !important;
    }
</style>
<div class="layui-fluid" id="examine-examine">
    <form class="layui-form" lay-filter="examine-examine-form">
        <div class="layui-form-item">
            <div class="layui-col-md6">
                <label class="layui-form-label">课题名称：</label>
                <div class="layui-input-block">
                    <input type="text" name="name" readonly class="layui-input">
                    <input type="hidden" name="declareId"/>
                    <input type="hidden" name="checkResult" id="checkResult"/>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-col-md6">
                <label class="layui-form-label">主持人：</label>
                <div class="layui-input-block">
                    <input type="text" name="leaderName" readonly class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-col-md6">
                <label class="layui-form-label">拟立项申请书：</label>
                <div class="layui-input-block">
                    <div class="layui-form-mid layui-word-aux"><a th:href="@{'download/' + ${applyFile.fileId}}"
                                                                  th:text="${applyFile.name}"></a></div>

                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-col-md6">
                <label class="layui-form-label">资格证明材料：</label>
                <div class="layui-input-block">
                    <div class="layui-form-mid layui-word-aux"><a th:href="@{'download/' + ${preItemFile.fileId}}"
                                                                  th:text="${preItemFile.name}"></a></div>
                </div>
            </div>
        </div>
        <div class="layui-form-item website-hide">
            <button class="layui-btn" lay-submit="" lay-filter="examine-examine-form-passSubmit" id="passSubmit"></button>
            <button class="layui-btn" lay-submit="" lay-filter="examine-examine-form-noPassSubmit" id="noPassSubmit"></button>
        </div>
    </form>
</div>

<script data-th-inline="javascript">
    layui.use(['form', 'formSelects','website'], function () {
        var $ = layui.$,
            formSelects = layui.formSelects,
            form = layui.form,
            website = layui.website,
            declare = [[${declare}]];
        form.render();
        initFormValue();
        formSelects.render();
        function initFormValue() {
            form.val("examine-examine-form", {
                "declareId": declare.declareId,
                "name": declare.name,
                "leaderName": declare.leaderName,
                "fileId": declare.fileId,
                "applyFileId": declare.applyFileId
            });
        }

        form.on('submit(examine-examine-form-passSubmit)', function (data) {

            examine(true,null);
            return false;
        });
        form.on('submit(examine-examine-form-noPassSubmit)', function (data) {
            //需要填写原因
            examine(false,$("#checkResult").val());
            return false;
        });

        function examine(isPass,checkResult){
            website.post(ctx + 'biz/preItem/examine/'+declare.declareId, {isPass:isPass,checkResult:checkResult}, function () {
                layer.closeAll();
                website.alert.success('审核完成');
                $('#website-preItem').find('#query').click();
            });
        }

    });
</script>